﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using BookStore.Solution.BLL;

namespace BookStore.Solution.Presentation
{
    public partial class frmSearchAccountByID : DevComponents.DotNetBar.OfficeForm
    {
        private String Keyword = "";
        AccountManager Accounts;
        public DataTable SearchResult { get; set; }
        public frmSearchAccountByID()
        {
            InitializeComponent();
            Accounts = new AccountManager();
        }

        private void btnTimKiem_Click(object sender, EventArgs e)
        {
            Keyword = txtKey.Text;
            if (Keyword != "")
            {
                SearchResult = Accounts.SearchbyUserName(Keyword);
                Close();
            }
            else
            {
                MessageBox.Show("Chưa nhập từ khóa tìm kiếm", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtKey.Border.BorderColor = Color.Red;
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            SearchResult = null;
            Close();
        }

        private void txtKey_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                btnSearch.PerformClick();
        }
    }
}